package mk.finki.chemistry.dice;

import org.jgap.Configuration;
import org.jgap.Genotype;
import org.jgap.IBreeder;
import org.jgap.InvalidConfigurationException;
import org.jgap.Population;

public class DiceGenotype extends Genotype {

	public DiceGenotype(Configuration a_configuration, Population a_population)
			throws InvalidConfigurationException {
		super(a_configuration, a_population);
	}

	public synchronized boolean evolve1() {
		IBreeder breeder = getConfiguration().getBreeder();
		Population newPop = null;
		try {
			newPop = ((DiceBreeder) breeder).evolve1(getPopulation(), getConfiguration());
			setPopulation(newPop);
			return true;
		} catch (NoValueChromosomesException e) {
			setPopulation(e.getPopulation());
			return false;
		}
	}

}
